﻿<div id="AddParameter">
    <input type="text" id="tbNewParameter" name="tbNewParameter" class="text" value="" />
    <input type="button" value="Сохранить" class="button" name="btnSaveParameter" id="btnSaveParameter" />
</div>

<script type="text/javascript">
    $(function () 
    {
        $("#btnSaveParameter").click(function (event) 
        {
            if ($("text#tbNewParameter").val() != "") 
            {
                $.ajax({ url: "/Categories/AddParameter",
                    type: 'POST',
                    data: { itemValue: $("#tbNewParameter").val() },
                    success: function (responce) 
                    {
                        $("#ParametersList").replaceWith(responce)
                    },
                    error: function (xhr) 
                    {
                        alert("Ошибка!");
                    }

                });
            }
        });
    })
</script>